Skip to content

feat: change validator#843

Merged
dieppa merged 4 commits intodevelopfrom
features/change-validator
Feb 24, 2026
Merged

feat: change validator#843
dieppa merged 4 commits intodevelopfrom
features/change-validator

Conversation

@davidfrigolet
Copy link
Contributor

feat: change validator

@Override
protected RecoveryStrategy getRecovery() {
Recovery rec = changeClass.getAnnotation(Recovery.class);
return rec != null ? rec.strategy() : RecoveryStrategy.MANUAL_INTERVENTION;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should preserve the actual value(so when it's null, get the default value from the annotaiton). Otherwise, the test becomes misleading because it injects a default that production code might not apply.

Right now, @recovery defaults to MANUAL_INTERVENTION, so it happens to match the implicit default we’re injecting. But that’s fragile: if we ever change the annotation’s default in the future, this test will silently keep passing while no longer reflecting real behavior.

Comment on lines +78 to +80
public static ChangeValidator of(Class<?> changeClass) {
return new ChangeValidator(changeClass);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this is in the parent class, so in the future, when we add a potential validator for template-based changes, the user doesn't need to use a different class for constructor

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aligned with this. We can rename the class. This becomes CodeBasedChangeValidator and the parent becomes ChangeValidator

@dieppa dieppa merged commit 3f81afe into develop Feb 24, 2026
4 checks passed
dieppa pushed a commit that referenced this pull request Feb 24, 2026
Add ChangeValidator, a fluent test API to validate code-based Change contracts.
Asserts annotation-derived metadata and structural invariants (id/author/order, flags).
Validates target system routing, recovery strategy, and apply/rollback method presence.
dieppa pushed a commit that referenced this pull request Feb 24, 2026
Add ChangeValidator, a fluent test API to validate code-based Change contracts.
Asserts annotation-derived metadata and structural invariants (id/author/order, flags).
Validates target system routing, recovery strategy, and apply/rollback method presence.
@dieppa dieppa deleted the features/change-validator branch February 27, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants